{{left_sidebar_enabled,right_sidebar_enabled=False,('message' in globals())}}
{{extend 'layout.html'}}


{{block header}}
    {{if auth.user.username == 'oem1':}}
        <header class="container-fluid background">
          <div class="jumbotron text-center">
            {{if response.title:}}
            <h1>{{=response.title}}
                    <small> - Director Repository</small></h1>
            {{pass}}
          </div>
        </header>
    {{else:}}
        <header class="container-fluid road_background">
          <div class="jumbotron text-center">
            {{if response.title:}}
            <h1>{{=response.title}}
                    <small> - Image Repository</small></h1>
            {{pass}}
          </div>
        </header>
    {{pass}}
{{end}}


{{block body}}

<!--{{if 'error_message' in globals():}}
<h2>{{=error_message}}</h2>
{{else:}}
{{pass}}-->

{{if 'form' in globals():}}
<h2>{{=form}}</h2>
{{else:}}
{{pass}}


{{if 'db_contents' in globals():}}
<h2>{{=db_contents}}</h2>
{{else:}}
{{pass}}




<!--
{{if 'changed_ecu_list' in globals():}}
<h2>{{=changed_ecu_list}}</h2>
{{else:}}
{{pass}}
-->

<!--{{if 'edited_vehicle' in globals():}}
    <script>
        console.log(" hello2! " + {{=edited_vehicle}});
        jQuery('tr[id={{=edited_vehicle}}]').each(function(){
            var button = $("<td><a id='update_button' href='/UPTANE/default/index'>Push Change</a></td>");
            button.click(function(){
                jQuery('input[value={{=edited_vehicle}}]').attr('checked', 'checked');
            });
            button.appendTo(jQuery(this));
        });
    </script>
{{else:}}
{{pass}}
-->

{{if 'available_updates' in globals():}}
    <script>
        console.log(" hello3! " + {{=available_updates}});
        for (i = 0; i < {{=available_updates}}.length; i++){
            console.log( "yepp: " + i);
            console.log({{=available_updates}}[i]);
            var id_num = {{=available_updates}}[i];
            jQuery('tr[id=' + id_num + ']').each(function(){
                var button = $("<td><div id='available_update_button'>AVAILABLE UPDATE</div></td>");
                //button.click(function(){
                //    alert($("#available_update_button").attr("href"));
                //});
                button.appendTo(jQuery(this));
            });
        }
    </script>
{{else:}}
{{pass}}


{{if auth.user.username == 'oem1':}}
<h1 align="right"><input type="button" class="hacked_btn" onclick="location.href='hacked';"/></h1>
<!--<h1 align="left">{{=A('', _title="Reset System" , _class="reset_system",callback=URL('reset_system'))}}</h1>-->
{{else:}}
<h1 align="right"><input type="button" class="hacked_btn" onclick="location.href='hacked_repo';"/></h1>
{{pass}}

</body>
{{end}}

